Skip to content

Conversation

zakirkun
Copy link

@zakirkun zakirkun commented Jan 3, 2025

This commit adds a new function called Bind to the strip package. The Bind function takes an input interface and strips HTML tags from specific string fields in a struct. It iterates through the fields of the struct, checks for the presence of the "strip_tag" tag set to "true", and if found, it strips the HTML tags from the corresponding string field.

The Bind function ensures that the input is a pointer to a struct and that the dereferenced value is indeed a struct. It uses reflection to access and modify the field values.

This commit also includes a test case for the Bind function, which validates the functionality by creating a sample struct and asserting that the HTML tags are successfully stripped from the specified fields.

This commit adds a new function called Bind to the strip package. The Bind function takes an input interface and strips HTML tags from specific string fields in a struct. It iterates through the fields of the struct, checks for the presence of the "strip_tag" tag set to "true", and if found, it strips the HTML tags from the corresponding string field.

The Bind function ensures that the input is a pointer to a struct and that the dereferenced value is indeed a struct. It uses reflection to access and modify the field values.

This commit also includes a test case for the Bind function, which validates the functionality by creating a sample struct and asserting that the HTML tags are successfully stripped from the specified fields.

Closes #123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant